<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Object 属性转换为属性数组</title>
</head>
<body>
    <script>
        const obj = { a: 1, b: 2, c: 3 };
        console.log('%c   obj: ','color: MidnightBlue; background: Aquamarine; font-size: 20px;', obj);

        Object.entries(obj);
        console.log('%c   Object.entries(obj): ','color: MidnightBlue; background: Aquamarine; font-size: 20px;', Object.entries(obj));
        // console.log('%c   obj: ','color: MidnightBlue; background: Aquamarine; font-size: 20px;', obj);

        // Output
        // (3) [Array(2), Array(2), Array(2)]
        // 0: (2) ["a", 1]
        // 1: (2) ["b", 2]
        // 2: (2) ["c", 3]
        // length: 3

        // Object.keys(obj);
        console.log('%c   Object.keys(obj): ','color: MidnightBlue; background: Aquamarine; font-size: 20px;', Object.keys(obj));

        // (3) ["a", "b", "c"]

        // Object.values(obj);
        console.log('%c   Object.values(obj): ','color: MidnightBlue; background: Aquamarine; font-size: 20px;', Object.values(obj));
        // (3) [1, 2, 3]

    </script>
</body>
</html>